package cn.edu.scau.dropship.mapper;

import cn.edu.scau.dropship.entity.TraceExample;
import cn.edu.scau.dropship.entity.TraceKey;
import java.util.List;
import org.apache.ibatis.annotations.Arg;
import org.apache.ibatis.annotations.ConstructorArgs;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TraceMapper {
    @SelectProvider(type=TraceSqlProvider.class, method="countByExample")
    long countByExample(TraceExample example);

    @DeleteProvider(type=TraceSqlProvider.class, method="deleteByExample")
    int deleteByExample(TraceExample example);

    @Delete({
        "delete from trace",
        "where wallets_id = #{walletsId,jdbcType=INTEGER}",
          "and fc_id = #{fcId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(TraceKey key);

    @Insert({
        "insert into trace (wallets_id, fc_id)",
        "values (#{walletsId,jdbcType=INTEGER}, #{fcId,jdbcType=INTEGER})"
    })
    int insert(TraceKey record);

    @InsertProvider(type=TraceSqlProvider.class, method="insertSelective")
    int insertSelective(TraceKey record);

    @SelectProvider(type=TraceSqlProvider.class, method="selectByExample")
    @ConstructorArgs({
        @Arg(column="wallets_id", javaType=Integer.class, jdbcType=JdbcType.INTEGER, id=true),
        @Arg(column="fc_id", javaType=Integer.class, jdbcType=JdbcType.INTEGER, id=true)
    })
    List<TraceKey> selectByExample(TraceExample example);

    @UpdateProvider(type=TraceSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") TraceKey record, @Param("example") TraceExample example);

    @UpdateProvider(type=TraceSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") TraceKey record, @Param("example") TraceExample example);
}